﻿using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
    // Token: 0x02000A81 RID: 2689
    internal class XCharacterItemDocument : XDocComponent
    {
        // Token: 0x17002F9F RID: 12191
        // (get) Token: 0x0600A387 RID: 41863 RVA: 0x001BFF74 File Offset: 0x001BE174
        public override uint ID
        {
            get
            {
                return XCharacterItemDocument.uuID;
            }
        }

        // Token: 0x17002FA0 RID: 12192
        // (get) Token: 0x0600A388 RID: 41864 RVA: 0x001BFF8C File Offset: 0x001BE18C
        // (set) Token: 0x0600A389 RID: 41865 RVA: 0x001BFFA4 File Offset: 0x001BE1A4
        public CharacterItemBagHandler Handler
        {
            get
            {
                return this._handler;
            }
            set
            {
                this._handler = value;
            }
        }

        // Token: 0x17002FA1 RID: 12193
        // (get) Token: 0x0600A38A RID: 41866 RVA: 0x001BFFB0 File Offset: 0x001BE1B0
        public bool bHasAvailableItems
        {
            get
            {
                return this._AvailableItems.bHasNew;
            }
        }

        // Token: 0x17002FA2 RID: 12194
        // (get) Token: 0x0600A38B RID: 41867 RVA: 0x001BFFD0 File Offset: 0x001BE1D0
        public XNewItemTipsMgr NewItems
        {
            get
            {
                return this._NewItems;
            }
        }

        // Token: 0x17002FA3 RID: 12195
        // (get) Token: 0x0600A38C RID: 41868 RVA: 0x001BFFE8 File Offset: 0x001BE1E8
        public XNewItemTipsMgr AvailableItems
        {
            get
            {
                return this._AvailableItems;
            }
        }

        // Token: 0x17002FA4 RID: 12196
        // (get) Token: 0x0600A38D RID: 41869 RVA: 0x001C0000 File Offset: 0x001BE200
        public static List<XTuple<uint, string>> TabList
        {
            get
            {
                return XCharacterItemDocument.m_tabList;
            }
        }

        // Token: 0x17002FA5 RID: 12197
        // (get) Token: 0x0600A38E RID: 41870 RVA: 0x001C0017 File Offset: 0x001BE217
        // (set) Token: 0x0600A38F RID: 41871 RVA: 0x001C001F File Offset: 0x001BE21F
        public uint BagType { get; set; }

        // Token: 0x17002FA6 RID: 12198
        // (get) Token: 0x0600A390 RID: 41872 RVA: 0x001C0028 File Offset: 0x001BE228
        // (set) Token: 0x0600A391 RID: 41873 RVA: 0x001C0040 File Offset: 0x001BE240
        public bool bBlock
        {
            get
            {
                return this.m_bBlock;
            }
            set
            {
                this.m_bBlock = value;
                if (!this.m_bBlock)
                {
                    if (this.Handler != null && this.Handler.IsVisible())
                    {
                        this.Handler.UpdateBag();
                    }
                }
            }
        }

        // Token: 0x0600A392 RID: 41874 RVA: 0x001C008A File Offset: 0x001BE28A
        public static void Execute(OnLoadedCallback callback = null)
        {
            XCharacterItemDocument.ItemID_Index.Clear();
            XCharacterItemDocument.TypeID_Index.Clear();
            XCharacterItemDocument.AsyncLoader.AddTask("Table/ItemUseButtonList", XCharacterItemDocument.m_ItemUseButtonListTable, false);
            XCharacterItemDocument.AsyncLoader.Execute(callback);
        }

        // Token: 0x0600A393 RID: 41875 RVA: 0x001C00C8 File Offset: 0x001BE2C8
        public static void OnTableLoaded()
        {
            for (int i = 0; i < XCharacterItemDocument.m_ItemUseButtonListTable.Table.Length; i++)
            {
                ItemUseButtonList.RowData rowData = XCharacterItemDocument.m_ItemUseButtonListTable.Table[i];
                if (rowData.ItemID > 0U)
                {
                    if (XCharacterItemDocument.ItemID_Index.ContainsKey(rowData.ItemID))
                    {
                        XSingleton<XDebug>.singleton.AddErrorLog("Duplicate ItemID in ItemUseButtonList ", rowData.ItemID.ToString(), null, null, null, null);
                    }
                    else
                    {
                        XCharacterItemDocument.ItemID_Index.Add(rowData.ItemID, i);
                    }
                }
                else
                {
                    if (rowData.TypeID > 0U)
                    {
                        if (XCharacterItemDocument.TypeID_Index.ContainsKey(rowData.TypeID))
                        {
                            XSingleton<XDebug>.singleton.AddErrorLog("Duplicate TypeID in ItemUseButtonList ", rowData.TypeID.ToString(), null, null, null, null);
                        }
                        else
                        {
                            XCharacterItemDocument.TypeID_Index.Add(rowData.TypeID, i);
                        }
                    }
                }
            }
        }

        // Token: 0x0600A394 RID: 41876 RVA: 0x001C01C4 File Offset: 0x001BE3C4
        public static void InitFromGlobalConfig()
        {
            XCharacterItemDocument._NoRedPointItems.Clear();
            List<int> intList = XSingleton<XGlobalConfig>.singleton.GetIntList("NoRedPointItems");
            XCharacterItemDocument._NoRedPointItems.UnionWith(intList);
        }

        // Token: 0x0600A395 RID: 41877 RVA: 0x001C01FC File Offset: 0x001BE3FC
        private ItemUseButtonList.RowData GetByItemID(uint itemID)
        {
            int num;
            ItemUseButtonList.RowData result;
            if (XCharacterItemDocument.ItemID_Index.TryGetValue(itemID, out num))
            {
                result = XCharacterItemDocument.m_ItemUseButtonListTable.Table[num];
            }
            else
            {
                result = null;
            }
            return result;
        }

        // Token: 0x0600A396 RID: 41878 RVA: 0x001C0230 File Offset: 0x001BE430
        private ItemUseButtonList.RowData GetByTypeID(uint typeID)
        {
            int num;
            ItemUseButtonList.RowData result;
            if (XCharacterItemDocument.TypeID_Index.TryGetValue(typeID, out num))
            {
                result = XCharacterItemDocument.m_ItemUseButtonListTable.Table[num];
            }
            else
            {
                result = null;
            }
            return result;
        }

        // Token: 0x0600A397 RID: 41879 RVA: 0x001C0264 File Offset: 0x001BE464
        public ItemUseButtonList.RowData GetButtonData(uint itemID, uint typeID)
        {
            ItemUseButtonList.RowData rowData = this.GetByItemID(itemID);
            if (rowData == null)
            {
                rowData = this.GetByTypeID(typeID);
            }
            return rowData;
        }

        // Token: 0x0600A398 RID: 41880 RVA: 0x001C0290 File Offset: 0x001BE490
        public override void OnAttachToHost(XObject host)
        {
            base.OnAttachToHost(host);
            this._NewItems.ClearItemType();
            List<int> intList = XSingleton<XGlobalConfig>.singleton.GetIntList("BagExcludedTypes");
            for (int i = 0; i < intList.Count; i++)
            {
                ItemType type = (ItemType)intList[i];
                this._NewItems.Filter.ExcludeItemType(type);
            }
            this._AvailableItems.ClearItemType();
            this._AvailableItems.Filter.AddItemType(ItemType.PECK);
            this._AvailableItems.Filter.AddItemType(ItemType.LOTTERY_BOX);
            this._AvailableItems.Filter.AddItemType(ItemType.FISH);
            this._AvailableItems.Filter.AddItemType(ItemType.PANDORA);
            this.m_UsedItem = 0UL;
            this.bBlock = false;
        }

        // Token: 0x0600A399 RID: 41881 RVA: 0x001C035C File Offset: 0x001BE55C
        protected override void EventSubscribe()
        {
            base.EventSubscribe();
            base.RegisterEvent(XEventDefine.XEvent_AddItem, new XComponent.XEventHandler(this.OnAddItem));
            base.RegisterEvent(XEventDefine.XEvent_RemoveItem, new XComponent.XEventHandler(this.OnRemoveItem));
            base.RegisterEvent(XEventDefine.XEvent_UpdateItem, new XComponent.XEventHandler(this.OnUpdateItem));
            base.RegisterEvent(XEventDefine.XEvent_ItemNumChanged, new XComponent.XEventHandler(this.OnItemNumChanged));
            base.RegisterEvent(XEventDefine.XEvent_UnloadEquip, new XComponent.XEventHandler(this.OnUnloadEquip));
            base.RegisterEvent(XEventDefine.XEvent_PlayerLevelChange, new XComponent.XEventHandler(this.OnPlayerLevelChange));
        }

        // Token: 0x0600A39A RID: 41882 RVA: 0x001C03F4 File Offset: 0x001BE5F4
        public List<XItem> GetItem()
        {
            ulong filterValue = this._NewItems.Filter.FilterValue;
            this.m_ItemList.Clear();
            for (int i = 0; i < XBagDocument.BagDoc.ItemBag.Count; i++)
            {
                XItem xitem = XBagDocument.BagDoc.ItemBag[i];
                if (xitem != null)
                {
                    ulong num = 1UL << (int)xitem.type;
                    if ((num & filterValue) > 0UL)
                    {
                        if (this.BagType > 0U)
                        {
                            if (xitem.itemConf != null && (uint)xitem.itemConf.BagType == this.BagType)
                            {
                                this.m_ItemList.Add(xitem);
                            }
                        }
                        else
                        {
                            this.m_ItemList.Add(xitem);
                        }
                    }
                }
            }
            return this.m_ItemList;
        }

        // Token: 0x0600A39B RID: 41883 RVA: 0x001C04E4 File Offset: 0x001BE6E4
        public int GetTotalNum()
        {
            ulong filterValue = this._NewItems.Filter.FilterValue;
            this.m_ItemList.Clear();
            XBagDocument.BagDoc.GetItemsByType(filterValue, ref this.m_ItemList);
            return this.m_ItemList.Count;
        }

        // Token: 0x0600A39C RID: 41884 RVA: 0x001C0530 File Offset: 0x001BE730
        public void UpdateBagTypeReddot()
        {
            this.m_bagTypeRedDotDic.Clear();
            foreach (ulong uid in this.AvailableItems.NewItems)
            {
                XItem itemByUID = XBagDocument.BagDoc.GetItemByUID(uid);
                if (itemByUID != null)
                {
                    if (itemByUID.itemConf != null)
                    {
                        if (!this.m_bagTypeRedDotDic.ContainsKey((uint)itemByUID.itemConf.BagType))
                        {
                            this.m_bagTypeRedDotDic.Add((uint)itemByUID.itemConf.BagType, true);
                        }
                    }
                }
            }
            if (this.m_bagTypeRedDotDic.Count != 0)
            {
                if (!this.m_bagTypeRedDotDic.ContainsKey(0U))
                {
                    this.m_bagTypeRedDotDic.Add(0U, true);
                }
            }
            if (this.Handler != null && this.Handler.IsVisible())
            {
                this.Handler.UpdateTabRedDot();
            }
        }

        // Token: 0x0600A39D RID: 41885 RVA: 0x001C0654 File Offset: 0x001BE854
        protected bool OnAddItem(XEventArgs args)
        {
            XAddItemEventArgs xaddItemEventArgs = args as XAddItemEventArgs;
            bool flag = false;
            if (XSingleton<XEntityMgr>.singleton.Player != null)
            {
                uint level = XSingleton<XAttributeMgr>.singleton.XPlayerData.Level;
                bool flag3 = false;
                for (int i = 0; i < xaddItemEventArgs.items.Count; i++)
                {
                    if (!flag)
                    {
                        if (xaddItemEventArgs.items[i].Type != ItemType.EQUIP && xaddItemEventArgs.items[i].Type != ItemType.ARTIFACT && xaddItemEventArgs.items[i].Type != ItemType.EMBLEM)
                        {
                            flag = true;
                        }
                    }
                    if (xaddItemEventArgs.items[i].Type == ItemType.PANDORA)
                    {
                        PandoraHeart.RowData pandoraHeartConf = XBagDocument.GetPandoraHeartConf(xaddItemEventArgs.items[i].itemID, XSingleton<XAttributeMgr>.singleton.XPlayerData.BasicTypeID);
                        if (pandoraHeartConf != null)
                        {
                            break;
                        }
                        if (this._AvailableItems.AddItem(xaddItemEventArgs.items[i], true) && this._IsItemAvailable(xaddItemEventArgs.items[i], level))
                        {
                            this._AvailableItems.AddItem(xaddItemEventArgs.items[i], false);
                            flag3 = true;
                        }
                    }
                    else
                    {
                        if (this._AvailableItems.AddItem(xaddItemEventArgs.items[i], true) && this._IsItemAvailable(xaddItemEventArgs.items[i], level))
                        {
                            this._AvailableItems.AddItem(xaddItemEventArgs.items[i], false);
                            flag3 = true;
                        }
                    }
                }
                if (flag3)
                {
                    XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_Bag_Item, true);
                }
            }
            if (flag)
            {
                this.UpdateRedPoints();
            }
            bool result;
            if (this._handler == null || !this._handler.active)
            {
                if (xaddItemEventArgs.bNew)
                {
                    this._NewItems.AddItems(xaddItemEventArgs.items, false);
                }
                result = false;
            }
            else
            {
                if (!this.bBlock)
                {
                    this._handler.AddItem(xaddItemEventArgs.items);
                }
                result = true;
            }
            return result;
        }

        // Token: 0x0600A39E RID: 41886 RVA: 0x001C08B8 File Offset: 0x001BEAB8
        protected bool OnRemoveItem(XEventArgs args)
        {
            XRemoveItemEventArgs xremoveItemEventArgs = args as XRemoveItemEventArgs;
            bool flag = false;
            bool flag2 = false;
            for (int i = 0; i < xremoveItemEventArgs.types.Count; i++)
            {
                if (!flag2)
                {
                    if (xremoveItemEventArgs.types[i] != ItemType.EQUIP && xremoveItemEventArgs.types[i] != ItemType.ARTIFACT && xremoveItemEventArgs.types[i] != ItemType.EMBLEM)
                    {
                        flag2 = true;
                    }
                }
                if (this._AvailableItems.Filter.Contains(xremoveItemEventArgs.types[i]) && xremoveItemEventArgs.types[i] == ItemType.PANDORA)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                if (this._AvailableItems.RemoveItems(xremoveItemEventArgs.uids, xremoveItemEventArgs.types, false))
                {
                    XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_Bag_Item, true);
                }
            }
            if (flag2)
            {
                this.UpdateRedPoints();
            }
            bool result;
            if (this._handler == null || !this._handler.active)
            {
                result = false;
            }
            else
            {
                this._NewItems.RemoveItems(xremoveItemEventArgs.uids, xremoveItemEventArgs.types, true);
                if (!this.bBlock)
                {
                    this._handler.RemoveItem(xremoveItemEventArgs.uids);
                }
                result = true;
            }
            return result;
        }

        // Token: 0x0600A39F RID: 41887 RVA: 0x001C0A2C File Offset: 0x001BEC2C
        protected bool OnUpdateItem(XEventArgs args)
        {
            bool result;
            if (this._handler == null || !this._handler.active)
            {
                result = false;
            }
            else
            {
                XUpdateItemEventArgs xupdateItemEventArgs = args as XUpdateItemEventArgs;
                if (!this.bBlock)
                {
                    this._handler.UpdateItem(xupdateItemEventArgs.item);
                }
                result = true;
            }
            return result;
        }

        // Token: 0x0600A3A0 RID: 41888 RVA: 0x001C0A88 File Offset: 0x001BEC88
        protected bool OnItemNumChanged(XEventArgs args)
        {
            bool result;
            if (this._handler == null || !this._handler.active)
            {
                result = false;
            }
            else
            {
                XItemNumChangedEventArgs xitemNumChangedEventArgs = args as XItemNumChangedEventArgs;
                if (!this.bBlock)
                {
                    this._handler.ItemNumChanged(xitemNumChangedEventArgs.item);
                }
                result = true;
            }
            return result;
        }

        // Token: 0x0600A3A1 RID: 41889 RVA: 0x001C0AE4 File Offset: 0x001BECE4
        protected bool OnUnloadEquip(XEventArgs args)
        {
            bool result;
            if (this._handler == null || !this._handler.active)
            {
                result = false;
            }
            else
            {
                XUnloadEquipEventArgs xunloadEquipEventArgs = args as XUnloadEquipEventArgs;
                DlgBase<EquipTooltipDlg, EquipTooltipDlgBehaviour>.singleton.HideToolTip(true);
                result = true;
            }
            return result;
        }

        // Token: 0x0600A3A2 RID: 41890 RVA: 0x001C0B2B File Offset: 0x001BED2B
        public void UpdateRedPoints()
        {
            this.UpdateRedPoints(XSingleton<XAttributeMgr>.singleton.XPlayerData.Level);
        }

        // Token: 0x0600A3A3 RID: 41891 RVA: 0x001C0B44 File Offset: 0x001BED44
        public void UpdateRedPoints(uint playerLevel)
        {
            this._AvailableItems.Clear();
            this.m_AvailableItemList.Clear();
            XSingleton<XGame>.singleton.Doc.XBagDoc.GetItemsByType(this._AvailableItems.Filter.FilterValue, ref this.m_AvailableItemList);
            for (int i = 0; i < this.m_AvailableItemList.Count; i++)
            {
                if (this._IsItemAvailable(this.m_AvailableItemList[i], playerLevel))
                {
                    this._AvailableItems.AddItem(this.m_AvailableItemList[i], false);
                }
            }
            XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_Bag_Item, true);
            this.UpdateBagTypeReddot();
        }

        // Token: 0x0600A3A4 RID: 41892 RVA: 0x001C0BFC File Offset: 0x001BEDFC
        private bool _IsItemAvailable(XItem item, uint playerLevel)
        {
            ItemList.RowData itemConf = XBagDocument.GetItemConf(item.itemID);
            bool result;
            if (itemConf == null)
            {
                result = false;
            }
            else
            {
                if (item.Type == ItemType.PANDORA)
                {
                    PandoraHeart.RowData pandoraHeartConf = XBagDocument.GetPandoraHeartConf(item.itemID, XSingleton<XAttributeMgr>.singleton.XPlayerData.BasicTypeID);
                    int num = 0;
                    int num2 = 0;
                    if (pandoraHeartConf != null)
                    {
                        num = XBagDocument.BagDoc.ItemBag.GetItemCount((int)pandoraHeartConf.FireID);
                        num2 = XBagDocument.BagDoc.ItemBag.GetItemCount((int)pandoraHeartConf.PandoraID);
                    }
                    if (num2 < 1 || num < 1)
                    {
                        return false;
                    }
                }
                result = (!XCharacterItemDocument._NoRedPointItems.Contains(item.itemID) && (long)itemConf.ReqLevel <= (long)((ulong)playerLevel));
            }
            return result;
        }

        // Token: 0x0600A3A5 RID: 41893 RVA: 0x001C0CD8 File Offset: 0x001BEED8
        public void ToggleBlock(bool block)
        {
            XMainInterfaceDocument specificDocument = XDocuments.GetSpecificDocument<XMainInterfaceDocument>(XMainInterfaceDocument.uuID);
            specificDocument.AttrEventBlocker.bBlockReceiver = block;
            specificDocument.SetBlockItemsChange(block);
            //zcg XShowGetItemDocument specificDocument2 = XDocuments.GetSpecificDocument<XShowGetItemDocument>(XShowGetItemDocument.uuID);
            //zcg specificDocument2.bBlock = block;
            //zcg XLevelUpStatusDocument specificDocument3 = XDocuments.GetSpecificDocument<XLevelUpStatusDocument>(XLevelUpStatusDocument.uuID);
            //zcg specificDocument3.bBlock = block;
            this.bBlock = block;
        }

        // Token: 0x0600A3A6 RID: 41894 RVA: 0x001C0D34 File Offset: 0x001BEF34
        public void UseItem(ulong uid)
        {
            if (this.m_UsedItem <= 0UL)
            {
                RpcC2G_UseItem rpcC2G_UseItem = new RpcC2G_UseItem();
                rpcC2G_UseItem.oArg.uid = uid;
                rpcC2G_UseItem.oArg.count = 1U;
                rpcC2G_UseItem.oArg.OpType = ItemUseMgr.GetItemUseValue(ItemUse.BagFind);
                XSingleton<XClientNetwork>.singleton.Send(rpcC2G_UseItem);
                this.m_UsedItem = uid;
                this.ToggleBlock(true);
            }
        }

        // Token: 0x0600A3A7 RID: 41895 RVA: 0x001C0DA0 File Offset: 0x001BEFA0
        public void OnUseItem(UseItemArg oArg, UseItemRes oRes)
        {
            if (oRes.ErrorCode == ErrorCode.ERR_SUCCESS)
            {
                this.ShowEmblemTips(oArg, oRes);
            }
            //bool flag2 = oArg.uid != this.m_UsedItem && this.m_UsedItem > 0UL;
            if (/*!flag2*/oArg.uid == this.m_UsedItem || this.m_UsedItem <= 0UL)
            {
                if (oRes.ErrorCode > ErrorCode.ERR_SUCCESS)
                {
                    this.ToggleBlock(false);
                    //zcg 
//                     bool flag4 = this.Handler != null && this.Handler.active && this.Handler.WheelOfFortune.active;
//                     if (flag4)
//                     {
//                         this.Handler.WheelOfFortune.ToggleOperation(false, false);
//                     }
                }
                else
                {
                    if (this.Handler != null && this.Handler.IsVisible())
                    {
                        this.Handler.RefreshTips(oArg.uid);
                    }
                }
                this.m_UsedItem = 0UL;
            }
        }

        // Token: 0x0600A3A8 RID: 41896 RVA: 0x001C0E7C File Offset: 0x001BF07C
        private void ShowEmblemTips(UseItemArg oArg, UseItemRes oRes)
        {
            //bool flag = oArg.OpType != 0U && oArg.OpType != 1U;
            if (/*!flag*/oArg.OpType == 0U || oArg.OpType == 1U)
            {
                XItem itemByUID = XSingleton<XGame>.singleton.Doc.XBagDoc.GetItemByUID(oArg.uid);
                if (itemByUID != null && itemByUID.Type == ItemType.EMBLEM)
                {
                    //zcg 
//                     XEmblemItem xemblemItem = itemByUID as XEmblemItem;
//                     bool flag3 = !xemblemItem.bIsSkillEmblem;
//                     if (!flag3)
//                     {
//                         SkillEmblem.RowData emblemSkillConf = XEmblemDocument.GetEmblemSkillConf((uint)xemblemItem.itemID);
//                         bool flag4 = emblemSkillConf == null;
//                         if (!flag4)
//                         {
//                             XSkillTreeDocument specificDocument = XDocuments.GetSpecificDocument<XSkillTreeDocument>(XSkillTreeDocument.uuID);
//                             List<string> skillNames = new List<string>
//                             {
//                                 emblemSkillConf.SkillName,
//                                 emblemSkillConf.ExSkillScript
//                             };
//                             bool flag5 = specificDocument.IsEquipThisSkill(skillNames);
//                             bool flag6 = !flag5;
//                             if (!flag6)
//                             {
//                                 ItemList.RowData itemConf = XBagDocument.GetItemConf((int)emblemSkillConf.EmblemID);
//                                 bool flag7 = itemConf == null;
//                                 if (!flag7)
//                                 {
//                                     bool flag8 = oArg.OpType == 0U;
//                                     if (flag8)
//                                     {
//                                         XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("Active_Emblem"), itemConf.ItemName[0], emblemSkillConf.SkillPPT), "fece00");
//                                     }
//                                     else
//                                     {
//                                         bool flag9 = oArg.OpType == 1U;
//                                         if (flag9)
//                                         {
//                                             XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("Deactive_Emblem"), itemConf.ItemName[0], emblemSkillConf.SkillPPT), "fece00");
//                                         }
//                                     }
//                                 }
//                             }
//                         }
//                     }
                }
            }
        }

        // Token: 0x0600A3A9 RID: 41897 RVA: 0x001C1008 File Offset: 0x001BF208
        public void RefreshBag()
        {
            if (this._handler != null && this._handler.IsVisible())
            {
                this._handler.Refresh();
            }
        }

        // Token: 0x0600A3AA RID: 41898 RVA: 0x001C1040 File Offset: 0x001BF240
        public void ShowLotteryResult(int index)
        {
            //zcg 
//             bool flag = this.Handler != null && this.Handler.active && this.Handler.WheelOfFortune.active;
//             if (flag)
//             {
//                 this.Handler.WheelOfFortune.ShowResult(index);
//             }
        }

        // Token: 0x0600A3AB RID: 41899 RVA: 0x001C1090 File Offset: 0x001BF290
        public void ShowWheelView(XItem item)
        {
            //zcg 
//             bool flag = this.Handler != null && this.Handler.active;
//             if (flag)
//             {
//                 this.Handler.WheelOfFortune.OpenWheel(item as XLotteryBoxItem);
//             }
        }

        // Token: 0x0600A3AC RID: 41900 RVA: 0x001C10D0 File Offset: 0x001BF2D0
        private bool OnPlayerLevelChange(XEventArgs arg)
        {
            XPlayerLevelChangedEventArgs xplayerLevelChangedEventArgs = arg as XPlayerLevelChangedEventArgs;
            this.UpdateRedPoints(xplayerLevelChangedEventArgs.level);
            return true;
        }

        // Token: 0x0600A3AD RID: 41901 RVA: 0x001C10F8 File Offset: 0x001BF2F8
        protected override void OnReconnected(XReconnectedEventArgs arg)
        {
            this.m_UsedItem = 0UL;
            if (this.Handler != null && this.Handler.IsVisible())
            {
                this.Handler.UpdateBag();
            }
        }

        // Token: 0x0600A3AE RID: 41902 RVA: 0x001C1138 File Offset: 0x001BF338
        public static void InitTabList()
        {
            XCharacterItemDocument.m_tabList = new List<XTuple<uint, string>>();
            string value = XSingleton<XGlobalConfig>.singleton.GetValue("ItemBagType");
            string[] array = value.Split(XGlobalConfig.AllSeparators);
            for (int i = 0; i < array.Length; i += 2)
            {
                XTuple<uint, string> xtuple = new XTuple<uint, string>();
                if (!string.IsNullOrEmpty(array[i]) && !string.IsNullOrEmpty(array[i + 1]))
                {
                    xtuple.Item1 = uint.Parse(array[i]);
                    xtuple.Item2 = array[i + 1];
                    XCharacterItemDocument.m_tabList.Add(xtuple);
                }
            }
        }

        // Token: 0x04003B30 RID: 15152
        public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("CharacterItemDocument");

        // Token: 0x04003B31 RID: 15153
        public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();

        // Token: 0x04003B32 RID: 15154
        private static ItemUseButtonList m_ItemUseButtonListTable = new ItemUseButtonList();

        // Token: 0x04003B33 RID: 15155
        private static Dictionary<uint, int> ItemID_Index = new Dictionary<uint, int>();

        // Token: 0x04003B34 RID: 15156
        private static Dictionary<uint, int> TypeID_Index = new Dictionary<uint, int>();

        // Token: 0x04003B35 RID: 15157
        private CharacterItemBagHandler _handler = null;

        // Token: 0x04003B36 RID: 15158
        private XNewItemTipsMgr _NewItems = new XNewItemTipsMgr();

        // Token: 0x04003B37 RID: 15159
        private XNewItemTipsMgr _AvailableItems = new XNewItemTipsMgr();

        // Token: 0x04003B38 RID: 15160
        private static List<XTuple<uint, string>> m_tabList = null;

        // Token: 0x04003B39 RID: 15161
        private ulong m_UsedItem = 0UL;

        // Token: 0x04003B3A RID: 15162
        private List<XItem> m_ItemList = new List<XItem>();

        // Token: 0x04003B3B RID: 15163
        private List<XItem> m_AvailableItemList = new List<XItem>();

        // Token: 0x04003B3C RID: 15164
        private static HashSet<int> _NoRedPointItems = new HashSet<int>();

        // Token: 0x04003B3E RID: 15166
        private bool m_bBlock;

        // Token: 0x04003B3F RID: 15167
        public Dictionary<uint, bool> m_bagTypeRedDotDic = new Dictionary<uint, bool>();
    }
}
